with Solver_Package; use Solver_Package;
with Parts.Operations;
use Parts.Operations;
with Parts;
use Parts;
with Coordinates;
use Coordinates;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Generic_Sorted_List;
with Ada.Text_Io;
use Ada.Text_Io;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
with Rotation_Package;
use Rotation_Package;
--with Message;
--use Message;
procedure Solver_Package_Test_1 is
   Test_Array, Figure_Array : String_Array;
   Single_Block_Part, Expanded_figure : Coordinate_List.List_Pointer;
   Single_Coordinate : Coordinate_Type;
   List, figure : Part_List.List_Pointer;
   Temp_Pos_Array_1, Temp_Pos_Array_2 : Position_Array;
   Temp_Part, Temp_figure : Part_Type;
   Crap_Figure : Part_List.List_Pointer;
begin
   --2 2x2x1 1110 2x2x2 11000101
     Test_Array(1) := To_Unbounded_String("7");
   Test_Array(2) := To_Unbounded_String("2x2x1");
   Test_Array(3) := To_Unbounded_String("1110");
   Test_Array(4) := To_Unbounded_String("3x2x1");
   Test_Array(5) := To_Unbounded_String("111100");
   Test_Array(6) := To_Unbounded_String("3x2x1");
   Test_Array(7) := To_Unbounded_String("111010");
   Test_Array(8) := To_Unbounded_String("3x2x1");
   Test_Array(9) := To_Unbounded_String("110011");
   Test_Array(10) := To_Unbounded_String("2x2x2");
   Test_Array(11) := To_Unbounded_String("11101000");
   Test_Array(12) := To_Unbounded_String("2x2x2");
   Test_Array(13) := To_Unbounded_String("11001010");
   Test_Array(14) := To_Unbounded_String("2x2x2");
   Test_Array(15) := To_Unbounded_String("11000101");

   --  Test_Array(1) := To_Unbounded_String("3");
--     Test_Array(2) := To_Unbounded_String("2x2x2");
--     Test_Array(3) := To_Unbounded_String("11000101");
--     Test_Array(4) := To_Unbounded_String("3z2z1");
--     Test_Array(5) := To_Unbounded_String("001111");
--   Test_Array(6) := To_Unbounded_String("2x1x1");
--   Test_Array(7) := To_Unbounded_String("11");

   --Figure_Array(1) := To_Unbounded_String("1");
   --Figure_Array(2) := To_Unbounded_String("3x2x2");
   --Figure_Array(3) := To_Unbounded_String("010111010111");

   Figure_Array(1) := To_Unbounded_String("1");
   Figure_Array(2) := To_Unbounded_String("3x3x3");
   Figure_Array(3) := To_Unbounded_String("111111111111111111111111111");

   List := Create_Part_List(Test_Array);
   Figure := Create_Part_List(Figure_Array);
--   Part_List.Put(List);
   Find_All_Possible_Positions(List, Figure, 1);
   --Find_Possible_Positions(List, 3, 3, 3, Figure);
 --  Part_List.Put(List);
--   New_Line;

--   Part_List.Put(Figure);
--   New_Line;

   --Put("Listan innehåller: ");
  -- Put(Part_List.Length(List));
  -- Put(" Parts.");
  -- New_Line;

--     Temp_Part := Part_List.Find(List,1);
--     Temp_Pos_Array_1 := Get_Pos_Array(Temp_Part);
--     Temp_Part := Part_List.Find(List,2);
--     Temp_Pos_Array_2 := Get_Pos_Array(Temp_Part);

--     Put("Möjliga pos: ");
--     Part_List.Put(List);

--   Put("Part 1                    Part 2");
--   Put("--------------------------------");
 --    for I in 1..160 loop
--        Put(I);
--        New_Line;
--        exit when Coordinate_List.Empty(Temp_Pos_Array(I));
--        Coordinate_List.Put(Temp_Pos_Array_1(I));
--        Put("                    ");
--        Coordinate_List.Put(Temp_Pos_Array_2(I));
--        New_Line;
--     end loop;
--     Single_Coordinate.Number := 1;
--     Single_Coordinate.coordinates := (0,5,0);
--     Coordinate_List.Insert(Single_Block_Part, Single_Coordinate);
--     Temp_Figure := Part_List.Find(Figure, 1);
--     if Check_Intersection(Temp_Figure.coordinates, Single_Block_Part) then
--        Put("Single_block_part finns inom figuren.");
--        New_Line;
--     else
--        Put("Single_Block_Part finns inte inom figuren. Lägger till koordinaten i listan.");
--        New_Line;
--        Expanded_Figure := Parts.Expand_Coordinate_List(Temp_Figure.Coordinates,
--                                                        Single_Block_Part);
--        Put("Den nya figuren har koordianterna: ");
--        New_Line;
--        Coordinate_List.Put(Expanded_Figure);

--     end if;

   if Try_To_Build_Figure_With_Parts(List, Figure, Crap_figure) = True then
      Put("Hittade en lösning!");
   end if;

   --Nästa steg:

-- anvbänd Expand_Coordinate_List(...) och Check_Intersection(..) för att bygga upp hela figuren...

end Solver_Package_Test_1;

